centos修改系统时间并同步到硬件时间

您所在的位置:网站首页 linux 写入硬件时间 centos修改系统时间并同步到硬件时间

centos修改系统时间并同步到硬件时间

2024-07-14 12:54| 来源: 网络整理| 查看: 265

centos6:

修改时间:date -s "2020-04-17 16:01:40"

同步系统时间到硬件时间:hwclock --hctosys

显示硬件时间:hwclock --show

centos7:

1、查看当前的系统时间:

[root@bogon vagrant]# date Tue Jun 25 12:12:23 UTC 2019

2、 查看当前时区

[vagrant@bogon ~]$ timedatectl status       Local time: Tue 2019-06-25 20:29:47 CST   Universal time: Tue 2019-06-25 12:29:47 UTC         RTC time: Tue 2019-06-25 12:29:50        Time zone: Asia/Shanghai (CST, +0800)      NTP enabled: yes NTP synchronized: yes  RTC in local TZ: yes       DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.          This mode can not be fully supported. It will create various problems          with time zone changes and daylight saving time adjustments. The RTC          time is never updated, it relies on external facilities to maintain it.          If at all possible, use RTC in UTC by calling          'timedatectl set-local-rtc 0'.  

3、修改时间

 [root@bogon vagrant]# date -s "2019-06-25 20:13:00" Tue Jun 25 20:13:00 UTC 2019

4、修改时区

 [root@bogon vagrant]# timedatectl set-timezone Asia/Shanghai

5、 查看硬件时间

[root@bogon vagrant]# hwclock --show Tue 25 Jun 2019 08:13:56 PM CST  -0.891529 seconds

6、 同步系统时间和硬件时间

[root@bogon vagrant]# hwclock --hctosys

7、 本地时间写入硬件时间

[root@bogon vagrant]# timedatectl set-local-rtc 1 [root@bogon vagrant]# date Tue Jun 25 20:14:35 CST 2019

8、重启系统 reboot 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3